#!/bin/bash
set -eu

TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework

setupenvironment

buildpackage 'simple-package'

testpkgnotinstalled 'simple-package'
testequal 'W: Unable to locate package simple-package' aptcache showpkg 'simple-package'

generaterepository_and_switch_sources "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS"

testsuccess aptget update

testpkgnotinstalled 'simple-package'
testregexmatch 'Package: simple-package[ ]*
Versions:[ ]*
1-alt1@[0-9]+\(.*\)[ ]*
[ ]*
Reverse Depends:[ ]*
Dependencies:[ ]*
1-alt1@[0-9]+ -[ ]*
Provides:[ ]*
1-alt1@[0-9]+ - simple-package[ ]*
Reverse Provides:[ ]*
simple-package 1-alt1@[0-9]+[ ]*' aptcache showpkg 'simple-package'

aptgetinstallpackage 'simple-package'

testpkginstalled 'simple-package'
testregexmatch 'Package: simple-package[ ]*
Versions:[ ]*
1-alt1@[0-9]+\(.*\)[ ]*
[ ]*
Reverse Depends:[ ]*
Dependencies:[ ]*
1-alt1@[0-9]+ -[ ]*
Provides:[ ]*
1-alt1@[0-9]+ - simple-package[ ]*
Reverse Provides:[ ]*
simple-package 1-alt1@[0-9]+[ ]*' aptcache showpkg 'simple-package'
